\(\int \frac {\cot (a+i \log (x))}{x^2} \, dx\) [191]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 13, antiderivative size = 29 \[ \int \frac {\cot (a+i \log (x))}{x^2} \, dx=-\frac {i}{x}+2 i e^{-i a} \text {arctanh}\left (e^{-i a} x\right ) \]

[Out]

-I/x+2*I*arctanh(x/exp(I*a))/exp(I*a)

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 29, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.308, Rules used = {4592, 456, 464, 213} \[ \int \frac {\cot (a+i \log (x))}{x^2} \, dx=2 i e^{-i a} \text {arctanh}\left (e^{-i a} x\right )-\frac {i}{x} \]

[In]

Int[Cot[a + I*Log[x]]/x^2,x]

[Out]

(-I)/x + ((2*I)*ArcTanh[x/E^(I*a)])/E^(I*a)

Rule 213

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[b, 2])^(-1))*ArcTanh[Rt[b, 2]*(x/Rt[-a, 2])]
, x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (LtQ[a, 0] || GtQ[b, 0])

Rule 456

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Int[x^(m + n*(p + q
))*(b + a/x^n)^p*(d + c/x^n)^q, x] /; FreeQ[{a, b, c, d, m, n}, x] && NeQ[b*c - a*d, 0] && IntegersQ[p, q] &&
NegQ[n]

Rule 464

Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[c*(e*x)^(m +
 1)*((a + b*x^n)^(p + 1)/(a*e*(m + 1))), x] + Dist[(a*d*(m + 1) - b*c*(m + n*(p + 1) + 1))/(a*e^n*(m + 1)), In
t[(e*x)^(m + n)*(a + b*x^n)^p, x], x] /; FreeQ[{a, b, c, d, e, p}, x] && NeQ[b*c - a*d, 0] && (IntegerQ[n] ||
GtQ[e, 0]) && ((GtQ[n, 0] && LtQ[m, -1]) || (LtQ[n, 0] && GtQ[m + n, -1])) &&  !ILtQ[p, -1]

Rule 4592

Int[Cot[((a_.) + Log[x_]*(b_.))*(d_.)]^(p_.)*((e_.)*(x_))^(m_.), x_Symbol] :> Int[(e*x)^m*((-I - I*E^(2*I*a*d)
*x^(2*I*b*d))/(1 - E^(2*I*a*d)*x^(2*I*b*d)))^p, x] /; FreeQ[{a, b, d, e, m, p}, x]

Rubi steps \begin{align*} \text {integral}& = \int \frac {-i-\frac {i e^{2 i a}}{x^2}}{\left (1-\frac {e^{2 i a}}{x^2}\right ) x^2} \, dx \\ & = \int \frac {-i e^{2 i a}-i x^2}{x^2 \left (-e^{2 i a}+x^2\right )} \, dx \\ & = -\frac {i}{x}-2 i \int \frac {1}{-e^{2 i a}+x^2} \, dx \\ & = -\frac {i}{x}+2 i e^{-i a} \text {arctanh}\left (e^{-i a} x\right ) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.03 (sec) , antiderivative size = 44, normalized size of antiderivative = 1.52 \[ \int \frac {\cot (a+i \log (x))}{x^2} \, dx=-\frac {i}{x}+2 i \text {arctanh}(x \cos (a)-i x \sin (a)) \cos (a)+2 \text {arctanh}(x \cos (a)-i x \sin (a)) \sin (a) \]

[In]

Integrate[Cot[a + I*Log[x]]/x^2,x]

[Out]

(-I)/x + (2*I)*ArcTanh[x*Cos[a] - I*x*Sin[a]]*Cos[a] + 2*ArcTanh[x*Cos[a] - I*x*Sin[a]]*Sin[a]

Maple [A] (verified)

Time = 0.20 (sec) , antiderivative size = 24, normalized size of antiderivative = 0.83

method result size
risch \(-\frac {i}{x}+2 i \operatorname {arctanh}\left (x \,{\mathrm e}^{-i a}\right ) {\mathrm e}^{-i a}\) \(24\)

[In]

int(cot(a+I*ln(x))/x^2,x,method=_RETURNVERBOSE)

[Out]

-I/x+2*I*arctanh(x*exp(-I*a))*exp(-I*a)

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 36, normalized size of antiderivative = 1.24 \[ \int \frac {\cot (a+i \log (x))}{x^2} \, dx=\frac {i \, x e^{\left (-i \, a\right )} \log \left (x + e^{\left (i \, a\right )}\right ) - i \, x e^{\left (-i \, a\right )} \log \left (x - e^{\left (i \, a\right )}\right ) - i}{x} \]

[In]

integrate(cot(a+I*log(x))/x^2,x, algorithm="fricas")

[Out]

(I*x*e^(-I*a)*log(x + e^(I*a)) - I*x*e^(-I*a)*log(x - e^(I*a)) - I)/x

Sympy [A] (verification not implemented)

Time = 0.13 (sec) , antiderivative size = 29, normalized size of antiderivative = 1.00 \[ \int \frac {\cot (a+i \log (x))}{x^2} \, dx=- \left (i \log {\left (x - e^{i a} \right )} - i \log {\left (x + e^{i a} \right )}\right ) e^{- i a} - \frac {i}{x} \]

[In]

integrate(cot(a+I*ln(x))/x**2,x)

[Out]

-(I*log(x - exp(I*a)) - I*log(x + exp(I*a)))*exp(-I*a) - I/x

Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 99 vs. \(2 (19) = 38\).

Time = 0.25 (sec) , antiderivative size = 99, normalized size of antiderivative = 3.41 \[ \int \frac {\cot (a+i \log (x))}{x^2} \, dx=\frac {x {\left (i \, \cos \left (a\right ) + \sin \left (a\right )\right )} \log \left (x^{2} + 2 \, x \cos \left (a\right ) + \cos \left (a\right )^{2} + \sin \left (a\right )^{2}\right ) + x {\left (-i \, \cos \left (a\right ) - \sin \left (a\right )\right )} \log \left (x^{2} - 2 \, x \cos \left (a\right ) + \cos \left (a\right )^{2} + \sin \left (a\right )^{2}\right ) - 2 \, {\left ({\left (\cos \left (a\right ) - i \, \sin \left (a\right )\right )} \arctan \left (\sin \left (a\right ), x + \cos \left (a\right )\right ) + {\left (\cos \left (a\right ) - i \, \sin \left (a\right )\right )} \arctan \left (\sin \left (a\right ), x - \cos \left (a\right )\right )\right )} x - 2 i}{2 \, x} \]

[In]

integrate(cot(a+I*log(x))/x^2,x, algorithm="maxima")

[Out]

1/2*(x*(I*cos(a) + sin(a))*log(x^2 + 2*x*cos(a) + cos(a)^2 + sin(a)^2) + x*(-I*cos(a) - sin(a))*log(x^2 - 2*x*
cos(a) + cos(a)^2 + sin(a)^2) - 2*((cos(a) - I*sin(a))*arctan2(sin(a), x + cos(a)) + (cos(a) - I*sin(a))*arcta
n2(sin(a), x - cos(a)))*x - 2*I)/x

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 34, normalized size of antiderivative = 1.17 \[ \int \frac {\cot (a+i \log (x))}{x^2} \, dx=i \, e^{\left (-i \, a\right )} \log \left (x + e^{\left (i \, a\right )}\right ) - i \, e^{\left (-i \, a\right )} \log \left (-x + e^{\left (i \, a\right )}\right ) - \frac {i}{x} \]

[In]

integrate(cot(a+I*log(x))/x^2,x, algorithm="giac")

[Out]

I*e^(-I*a)*log(x + e^(I*a)) - I*e^(-I*a)*log(-x + e^(I*a)) - I/x

Mupad [B] (verification not implemented)

Time = 26.99 (sec) , antiderivative size = 31, normalized size of antiderivative = 1.07 \[ \int \frac {\cot (a+i \log (x))}{x^2} \, dx=-\frac {\mathrm {atan}\left (\frac {x}{\sqrt {-{\mathrm {e}}^{a\,2{}\mathrm {i}}}}\right )\,2{}\mathrm {i}}{\sqrt {-{\mathrm {e}}^{a\,2{}\mathrm {i}}}}-\frac {1{}\mathrm {i}}{x} \]

[In]

int(cot(a + log(x)*1i)/x^2,x)

[Out]

- (atan(x/(-exp(a*2i))^(1/2))*2i)/(-exp(a*2i))^(1/2) - 1i/x